package org.my.workflow.condition;

import java.util.Map;

import org.my.workflow.Condition;
import org.my.workflow.WorkflowContext;
import org.my.workflow.WorkflowException;
import org.my.workflow.element.ConditionElement;

/**
 * 判断一个用户是否能够处理该流程
 *
 * @author <a href="mailto:yang_y@sysnet.com.cn">Young Yang</a>
 */
public class CallerCondition implements Condition {

    public boolean isAllowed(WorkflowContext wfContext, ConditionElement conditionElement) throws WorkflowException {
        String owner = wfContext.getCaller();
        Map<String, String> args = conditionElement.getArgs();
        return args.containsKey(owner);
    }
}
